package com.mvc.controller;

public class ArrayTest {
    //学渣版
    public static void main(String[] args) {
        int[] array = new int[]{3, 4, 6, 7, 2, 43, 87, 24, 80, 1, 3, 2};
        //从前面找偶数，从后面找奇数，互换
        for (int i = 0; i < array.length; i++) {
            //如果当前的数是偶数
            if (array[i] % 2 == 0) {
                for (int j = array.length - 1; j > i; j--) {
                    if (array[j] % 2 == 1) {
                        int temp = array[i];
                        array[i] = array[j];
                        array[j] = temp;
                        break;
                    }
                }
            }
        }
        for (int i : array) {
            System.out.print(i + "  ");
        }
    }
}
